package us.mooresr.geartrack.client.events;

import com.google.gwt.event.shared.GwtEvent;
import com.google.gwt.event.shared.EventHandler;
import us.mooresr.geartrack.shared.model.ItemType;
import com.google.gwt.event.shared.HasHandlers;

public class ItemTypeDeletedEvent extends
		GwtEvent<ItemTypeDeletedEvent.ItemTypeDeletedHandler> {

	public static Type<ItemTypeDeletedHandler> TYPE = new Type<ItemTypeDeletedHandler>();
	private ItemType itemType;

	public interface ItemTypeDeletedHandler extends EventHandler {
		void onItemTypeDeleted(ItemTypeDeletedEvent event);
	}

	public ItemTypeDeletedEvent(ItemType itemType) {
		this.itemType = itemType;
	}

	public ItemType getItemType() {
		return itemType;
	}

	@Override
	protected void dispatch(ItemTypeDeletedHandler handler) {
		handler.onItemTypeDeleted(this);
	}

	@Override
	public Type<ItemTypeDeletedHandler> getAssociatedType() {
		return TYPE;
	}

	public static Type<ItemTypeDeletedHandler> getType() {
		return TYPE;
	}

	public static void fire(HasHandlers source, ItemType itemType) {
		source.fireEvent(new ItemTypeDeletedEvent(itemType));
	}
}
